﻿#ifndef MEASUREANGLE_H
#define MEASUREANGLE_H

#include "MeasureElement.h"
namespace Qly {

class MeasureDataSet;

/**
 * @brief The MeasureAngle class 测量三点构成的两条直线的夹角。其中第三个点为两个直线的交点。
 *                   m_results_um[0] 测量的角度，弧度为单位
 *                   m_results_um[1] 测量的角度，度为单位
 *                   textTemplate 支持 @angleDeg, @angle @id 3 个关键字
 */
class MeasureAngle3P: public MeasureElement
{
    friend MeasureDataSet;
public:
    MeasureAngle3P(MeasureDataSet *parent = nullptr);
    QString name() Q_DECL_OVERRIDE {return u8"角度";}
private:
    int mouseLButtonPress(QPointF point_pix, QPointF point_um) Q_DECL_OVERRIDE;
    int mouseMove(QPointF point_pix, QPointF point_um) Q_DECL_OVERRIDE;

    void compute(void) Q_DECL_OVERRIDE; //计算图元的位置，还有长度结果
    void updateText(bool updatePosition = true) Q_DECL_OVERRIDE;
    void paint( QPainter &painter ) Q_DECL_OVERRIDE; //画方法
};

/**
 * @brief The MeasureAngle class 测量两条直线的夹角。每条直线由两点确定。
 */
class MeasureAngle4P: public MeasureElement
{
    friend MeasureDataSet;
public:
    MeasureAngle4P(MeasureDataSet *parent = nullptr);
    QString name() Q_DECL_OVERRIDE {return u8"直线夹角";}
private:
    int mouseLButtonPress(QPointF point_pix, QPointF point_um) Q_DECL_OVERRIDE;
    int mouseMove(QPointF point_pix, QPointF point_um) Q_DECL_OVERRIDE;

    void compute(void) Q_DECL_OVERRIDE; //计算图元的位置，还有长度结果
    void updateText(bool updatePosition = true) Q_DECL_OVERRIDE;
    void paint( QPainter &painter ) Q_DECL_OVERRIDE; //画方法
    void drawCross(QPainter &painter, QPointF p);
};
}
#endif // MEASUREANGLE_H
